<?php

declare(strict_types=1);

namespace App\Controller\User;


use App\Controller\BaseController;
use App\Services\User\ResourceService;
use Hyperf\Context\Context;
use Hyperf\Di\Annotation\Inject;
use function Hyperf\Translation\trans;

class ResourceController extends BaseController
{
    #[Inject]
    public ResourceService $resourceService;

    /**
     * Note - vip用户查看用户私密图片/视频
     * DateTime 2024/7/18 16:17
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function vipSeeVideoOrPhoto()
    {
        $user = Context::get('user');
        $type = $this->request->post('type', 0);// 用户查看的资源类型 0图片 1视频
        $result = $this->resourceService->vipSeeVideoOrPhoto($user, $type);

        return $this->return($result);

    }

    /**
     * Note - 修改个人资料时, 返回用户基本信息配置：婚姻、体重、学历、收入、职业
     * DateTime 2024/7/18 17:34
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function userConfigInfo()
    {
        $language = Context::get('language', 'en');
        $data = trans('information', [], $language);
        $data['countries'] = trans('countries', [], $language);
        return $this->return(formatData($data));
    }

    /**
     * Note - 各种规则（速配规则+亲密度升级提示+邀请奖励+客服电话）
     * DateTime 2024/7/18 17:34
     * User Admin
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function activeRule()
    {
        $language = Context::get('language', 'en');
        $data = trans('active_rule', [], $language);
        return $this->return(formatData($data));
    }


}
